CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

SET( CMAKE_C_COMPILER "arm-none-linux-gnueabi-gcc" )
SET( CMAKE_CXX_COMPILER "arm-none-linux-gnueabi-g++" )
SET( LDFLAGS "-L/usr/local/arm/arm-none-linux-gnueabi/lib" )
SET( CPPFLAGS "-I/usr/local/arm/arm-none-linux-gnueabi/include" )
SET( CFLAGS "-I/usr/local/arm/arm-none-linux-gnueabi/include" )
SET( PROJECT_NAME camc )

PROJECT( ${PROJECT_NAME} )

IF( ${BUILD} MATCHES "release" )
	SET( CMAKE_BUILD_TYPE Release )
ELSE( ${BUILD} MATCHES "release" )
	SET( BUILD "debug" )
	SET( CMAKE_BUILD_TYPE Debug )
ENDIF( ${BUILD} MATCHES "release" )

SET( PROJECT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )
SET( CURRENT_DIRECTORY "." )
SET( TINYXML_DIRECTORY "${CURRENT_DIRECTORY}/tinyxml" )
SET( GXLIB_DIRECTORY "${CURRENT_DIRECTORY}/gxlib" )
SET( CAMCULATOR_DIRECTORY "${CURRENT_DIRECTORY}/camculator" )
SET( GIFLIB_DIRECTORY "${CURRENT_DIRECTORY}/giflib" )
SET( OPENCV_LABELING_DIRECTORY "${CURRENT_DIRECTORY}/opencv" )

INCLUDE_DIRECTORIES( ${CURRENT_DIRECTORY} )
INCLUDE_DIRECTORIES( ${CAMCULATOR_DIRECTORY} )
INCLUDE_DIRECTORIES( ${GXLIB_DIRECTORY} )
INCLUDE_DIRECTORIES( ${GIFLIB_DIRECTORY} )
INCLUDE_DIRECTORIES( ${OPENCV_LABELING_DIRECTORY} )
INCLUDE_DIRECTORIES( "/usr/local/arm/arm-none-linux-gnueabi/include" )
INCLUDE_DIRECTORIES( "/usr/local/arm/arm-none-linux-gnueabi/include/opencv" )
INCLUDE_DIRECTORIES( "/usr/local/arm/arm-none-linux-gnueabi/include/opencv2" )

LINK_DIRECTORIES( "/usr/local/arm/arm-none-linux-gnueabi/lib" )

ADD_DEFINITIONS( "-w" "-Os" )

AUX_SOURCE_DIRECTORY( ${CAMCULATOR_DIRECTORY} SRC )
AUX_SOURCE_DIRECTORY( ${TINYXML_DIRECTORY} TINYXML_SRC )
AUX_SOURCE_DIRECTORY( ${GXLIB_DIRECTORY} GXLIB_SRC )
AUX_SOURCE_DIRECTORY( ${GIFLIB_DIRECTORY} GIFLIB_SRC )
AUX_SOURCE_DIRECTORY( ${OPENCV_LABELING_DIRECTORY} OPENCV_SRC )

LINK_LIBRARIES( pthread jpeg png z opencv_highgui opencv_imgproc opencv_core rt )

ADD_EXECUTABLE( ${PROJECT_NAME} ${SRC} ${GXLIB_SRC} ${TINYXML_SRC} ${GIFLIB_SRC} ${OPENCV_SRC} )

